<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@page import="com.bean.LoginBean"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'userinfo.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
 
  <body>
   <%Class.forName("com.mysql.jdbc.Driver").newInstance(); 
String url="jdbc:mysql://localhost:3306/graduatedesign";  
String user="root";  
String password="root";
LoginBean LoginBean= (LoginBean)session.getAttribute("Loginbean");
Connection conn = DriverManager.getConnection(url, user, password); 
Statement sm=conn.createStatement();
ResultSet rs=sm.executeQuery("select * from userinfo where username='"+LoginBean.getUsername()+"'"); 
if(rs.next())
{%>
    <form name="f1" method="post"
		action="userinfo" onsubmit="return ck()">
		<table width="100%" border="0" cellpadding="0" cellspacing="1"
			bgcolor="#BBD3EB">
			<tr>
            <td height="27" align="center" background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">用户名</td>
            <td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<input style="border:1px;border-bottom-style:none;border-top-style:none;border-left-style:none;border-right-style:none;" type="text" id="username" name="username" size="50" value="<%=rs.getString(1)%>" readonly="readonly"/></td>
    						</tr>
			<tr>
            <td height="27" align="center" background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">姓名</td>
            <td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<input style="border:1px;border-bottom-style:none;border-top-style:none;border-left-style:none;border-right-style:none;" type="text" id="name" name="name" size="50" value="<%=rs.getString(2)%>" readonly="readonly"/></td>
    						</tr>
			<tr>
            <td height="27" align="center" background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">部门</td>
            <td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<input style="border:1px;border-bottom-style:none;border-top-style:none;border-left-style:none;border-right-style:none;" type="text" id="dept" name="dept" size="50" value="<%=rs.getString(7)%>" readonly="readonly"/></td>
    						</tr>
    		<tr>
            <td height="27" align="center" background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">状态</td>
            <td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<input style="border:1px;border-bottom-style:none;border-top-style:none;border-left-style:none;border-right-style:none;" type="text" id="status" name="status" size="50" value="<%=rs.getString(8)%>" readonly="readonly"/></td>
    						</tr>
			<tr>
				<td height="27" align="center"
					background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">性别</td>
				<td bgcolor="#FFFFFF">&nbsp;&nbsp; <select id="sex" name="sex">
                            			<option value="男"<%if(rs.getString(3).toString().equals("男")){%> selected = "selected"<%} %>>男</option>
                            			<option value="女"<%if(rs.getString(3).toString().equals("女")){%> selected = "selected"<%} %>>女</option>
                            		</select>
				</td>
			</tr>
			<tr>
				<td height="27" align="center"
					background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">年龄</td>
				<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<input type="text"
					id="age" name="age" value="<%=rs.getString(4)%>" /></td>
			</tr>
			<tr>
				<td height="27" align="center"
					background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">电话</td>
				<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<input type="text"
					id="tel" name="tel" value="<%=rs.getString(5)%>" /></td>
			</tr>
			<tr>
				<td height="27" align="center"
					background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF">EMAIL</td>
				<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<input type="text"
					id="email" name="email" value="<%=rs.getString(6)%>" /></td>
			</tr>
			<tr>
				<td height="27" align="center"
					background="/OA/admin/images/index1_72.gif" bgcolor="#FFFFFF"></td>
				<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;<input type="submit"
					value="提交" /></td>
			</tr>
		<script language="javascript">
                              function ck(){
                            	if(f1.title.value==""){
                            		alert("角色名不能为空");
                            		return false;
                            	}
                            	alert("操作成功");
                            }
                            </script>
		</table>
	</form>
	  <%} %>
  </body>
</html>
